import request from "@/utils/request";
import qs from 'qs'


function GetUserInfo() {
    return request.get('/login',qs.stringify(),
        {
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        })
}

// 修改商品状态
// http://dida100.com:8888/api/yp/orderlist
function UpdateOrder(data) {
    return request.put('/yp/orderlist',data,
    {
        headers: {
            "Content-Type": "application/json"
        }
    })

}
function GetOrder(data) {
    // http://127.0.0.1:8888/api/yp/orderlist
    return request.get('/yp/orderlist?'+qs.stringify(data),
        {
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        })
}
function GetStaticOrder() {  // 静态订单统计数据
    // http://127.0.0.1:8888/api/yp/orderlist
    return request.get('/yp/orders/static',
        {
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        })
}
// http://127.0.0.1:8888/api/yp/orderDetail/{orderNum}
// 订单详情
function GetDetailOrder(data) {  // 静态订单统计数据
    return request.get('yp/orderDetail/'+ data,
        {
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            }
        })
}
// http://dida100.com:8888/api/user
// 上传图片
// http://127.0.0.1:8888/api/file/upload
function UploadImg(data) {  // 静态订单统计数据
    return request.post('/api/file/upload', data,
        {
            headers: {
                "Content-Type": "multipart/form-data"
            }
        })
}

// 获取图片
// http://dida100.com:8888/api/yp/upimg
function GetImg() {
    return request.get('/upimg?current=1&size=10&album=1',
    {
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
        }
    })

}

export { GetOrder,GetUserInfo,GetStaticOrder,GetDetailOrder,UploadImg,GetImg,UpdateOrder}